<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{$config.title}管理后台</title>
<link href="__admin__/login/css/public.css" type="text/css" rel="stylesheet">
<link href="__admin__/login/css/style.css" type="text/css" rel="stylesheet">

<script type="text/javascript" src="__index__/js/jquery.js"></script>
<script src="__admin__/login/js/admin.js"></script>
<link rel="icon" href="{PHP}ECHO '/'.APP_UPLOADSS.'/';{/PHP}{$config.photo_img}"  type="image/x-icon">
</head>
<body>
<script type="text/javascript" src="__index__/js/jquery.js"></script>
<script src="__admin__/login/js/admin.js"></script>
{include file="/public/layui" /}

<div class="loginBody">
  <div class="smallpage loginContaint">
 	
    <div class=" loginRight"> <div class="center">
     </div>
      <div class="login_enter">
       <h2>后台管理系统</h2>
        <form method="post" action="" id='theForm' target="zhuchuang_frm">
          <div class="login_box">
            <input type="text" name="username" class="text" placeholder="请输入您的用户名">
            <i class="usIco"></i> </div>
          <div class="login_box">
            <input type="password" name="password" class="text" placeholder="请输入您的密码">
            <i class="pdIco"></i> </div>
          <div class="login_box">
            <input type="text" name="verify" class="text" placeholder="请输入验证码"><img style="    position: absolute;
    top: 0px;
    right: 0px;" id='imgVerify' src="{:captcha_src()}" onclick="this.src='{:captcha_src()}'">
            <i class="pdIco"></i> </div>
                    
          <input type='button' name="submit" class="pub_btn" value="登录">
		  <div id="error" class="login_box" style="bottom: 12px;text-align: center;background:none;color:#fff;""><span class="error"></span></div>
        </form>
      </div>
      <img src="__admin__/login/images/touying.png"> </div>
    <div class="clear"></div>
  </div>

</div>
<script type="text/javascript">
$(document).ready(function(){
	$('.login_enter .login_box input').focus(function(){
 		 $(this).parent().addClass('focus'); 
	  });
	  	$('.login_enter .login_box input').blur(function(){
 		 $(this).parent().removeClass('focus'); 
	  });

});
</script>

<script>
$(function(){
 function loginsubmit(){
                var username=true;
                var password=true;
                var vertify=true;

                if($('#theForm input[name=username]').val() == ''){
                    $('#error').html('<span class="error">用户名不能为空!</span>');
                    $('#theForm input[name=name]').focus();
                    username = false;
                    return false;
                }

                if($('#theForm input[name=password]').val() == ''){
                    $('#error').html('<span class="error">密码不能为空!</span>');
                    $('#theForm input[name=password]').focus();
                    password = false;
                    return false;
                }
                if($('#theForm input[name=verify]').val() == ''){
                    $('#error').html('<span class="error">验证码不能为空!</span>');
                    $('#theForm input[name=verify]').focus();
                    password = false;
                    return false;
                }

                

                if(vertify && $('#theForm input[name=username]').val() != '' && $('#theForm input[name=password]').val() != ''){
                    $.ajax({
                        async:false,
                        url:"{:url('login/login')}",
                        data:{'name':$('#theForm input[name=username]').val(),'pwd':$('#theForm input[name=password]').val(),'verify':$('#theForm input[name=verify]').val()},
                        type:'post',
                        dataType:'json',
                        success:function(res){
							
                            if(res.status != 1){
                               // $('#error').html('<span class="error">'+res.msg+'!</span>');
                               msg(res.msg);
                                username=false;
                                password=false;
                                return false;
                            }else{
                                top.location.href = res.url;
                            }
                        },
                        error : function(XMLHttpRequest, textStatus, errorThrown) {
							
							msg('网络失败，请刷新页面后重试!');
                           
                        }
                    });
                }else{
                    return false;
                }
            }

            $('.submit_span .sub').on('click',function(){
                $('.code').show();
            });
            $('#theForm input[name=submit]').on('click',function(){
				
                loginsubmit();
            });
			
			
			
        });
</script>

</body></html>